﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;

public class EditorWindowUtils
{
    public static Texture2D LoadTexture(string imageName)
    {
        return LoadTexture("Assets/Editor/Res/", imageName);
    }

    public static Texture2D LoadTexture(string pathName, string imageName)
    {
        Texture2D texture2D = null;
        if (texture2D == null)
        {
            texture2D = (AssetDatabase.LoadAssetAtPath(pathName + imageName, typeof(Texture2D)) as Texture2D);
        }
        if (texture2D != null)
        {
            texture2D.hideFlags = HideFlags.HideInHierarchy | HideFlags.DontSaveInEditor | HideFlags.NotEditable;
        }
        return texture2D;
    }
}